home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / enhanc1a / modlistv.bas
BASIC Source File  |  1999-10-14  |  78KB  |  1,857 lines

  1. Attribute VB_Name = "modListViewEnh"
  2.  
  3. '/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\
  4. '/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\
  5. '
  6. ' File Name: modListViewEnh.mod
  7. ' By: John Allan Lee
  8. ' Email Address: zero42@quik.com
  9. ' Last Revision: Wednesday, October 13, 1999
  10. '
  11. ' Assumes: None
  12. '
  13. ' Number of Functions: 24
  14. '
  15. ' Includes: EnhListView_ResizeColumns(lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  16. ' Type: Public Function
  17. ' Description: Resizes all Columns in a ListView to fit the text in the rows
  18. '
  19. ' Includes: EnhListView_SortColumns(lstListViewName As ListView, usdColIndex, Optional bolShowErrors As Boolean) As Boolean
  20. ' Type: Public Function
  21. ' Description: Use on ColumnClick to sort by that Column
  22. '              Toggles between Ascending and Descending Sorts
  23. '
  24. ' Includes: EnhListView_ResizeColumnCaptions(lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  25. ' Type: Public Function
  26. ' Description: Resizes all Columns in a ListView to the Text in the Column Caption
  27. '
  28. ' Includes: EnhListView_ResizeColumnHeaders(lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  29. ' Type: Public Function
  30. ' Description: Resizes the ColumnHeaders in a ListView to the Width
  31. '              of the ListView
  32. '
  33. ' Includes: EnhListView_Add_FullRowSelect( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  34. ' Type: Public Function
  35. ' Description: Enables Full Row Select in a ListView
  36. '
  37. ' Includes: EnhListView_Rem_FullRowSelect( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  38. ' Type: Public Function
  39. ' Description: Disables Full Row Select in a ListView
  40. '
  41. ' Includes: EnhListView_Add_GridLines( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  42. ' Type: Public Function
  43. ' Description: Enables GridLines in a ListView
  44. '
  45. ' Includes: EnhListView_Rem_GridLines( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  46. ' Type: Public Function
  47. ' Description: Disables GridLines in a ListView
  48. '
  49. ' Includes: EnhListView_Add_CheckBoxes( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  50. ' Type: Public Function
  51. ' Description: Enables CheckBoxes in a ListView
  52. '
  53. ' Includes: EnhListView_Rem_CheckBoxes( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  54. ' Type: Public Function
  55. ' Description: Disables CheckBoxes in a ListView
  56. '
  57. ' Includes: EnhListView_Add_AllowRepositioning( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  58. ' Type: Public Function
  59. ' Description: Enables Repositioning of ColumnHeaders in a ListView
  60. '
  61. ' Includes: EnhListView_Rem_AllowRepositioning( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  62. ' Type: Public Function
  63. ' Description: Disables Repositioning of ColumnHeaders in a ListView
  64. '
  65. ' Includes: EnhListView_Add_TrackSelected( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  66. ' Type: Public Function
  67. ' Description: Enables TrackSelected in a ListView
  68. '
  69. ' Includes: EnhListView_Rem_TrackSelected( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  70. ' Type: Public Function
  71. ' Description: Disables TrackSelected in a ListView
  72. '
  73. ' Includes: EnhListView_Add_OneClickActivate( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  74. ' Type: Public Function
  75. ' Description: Enables One Click Activate in a ListView
  76. '
  77. ' Includes: EnhListView_Rem_OneClickActivate( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  78. ' Type: Public Function
  79. ' Description: Disables One Click Activate in a ListView
  80. '
  81. ' Includes: EnhListView_Add_TwoClickActivate( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  82. ' Type: Public Function
  83. ' Description: Enables Two Click Activate in a ListView
  84. '
  85. ' Includes: EnhListView_Rem_TwoClickActivate( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  86. ' Type: Public Function
  87. ' Description: Enables Full Row Select in a ListView
  88. '
  89. ' Includes: EnhListView_Add_SubitemImages( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  90. ' Type: Public Function
  91. ' Description: Enables SubItem Images in a ListView
  92. '
  93. ' Includes: EnhListView_Rem_SubitemImages( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  94. ' Type: Public Function
  95. ' Description: Disables SubItem Images in a ListView
  96. '
  97. ' Includes: EnhLitView_CheckAllItems( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  98. ' Type: Public Function
  99. ' Description: Checks all Items in the ListView
  100. '
  101. ' Includes: EnhLitView_UnCheckAllItems( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  102. ' Type: Public Function
  103. ' Description: Unchecks all items in a ListView
  104. '
  105. ' Includes: EnhListView_InvertAllChecks( lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  106. ' Type: Public Function
  107. ' Description: Inverts all checked items in a ListView
  108. '
  109. ' Includes: EnhListView_Toggle_FlatColumnHeaders( frmFormName As Form, lstListViewName As ListView, Optional bolShowErrors As Boolean) As Boolean
  110. ' Type: Public Function
  111. ' Description: Toggles FlatColumnHeaders in a ListView
  112. '
  113. ' Variable Name: LengthPerCharacter
  114. ' Type: Long
  115. ' Description: Used to set the length in twips per character for column spacing
  116. '              Defaults to 80 if not specified
  117. '
  118. ' Disclaimer:
  119. '   Code provided by John Allan Lee 'as is', without warranties as to
  120. '   performance, fitness, merchantability, and any other warranty
  121. '   (whether expressed or implied).
  122. '   This source code is copyrighted by John Allan Lee who has exclusive
  123. '   rights to distribute it.
  124. '
  125. ' Freeware:
  126. '   Code is freely redistributable for personal use in source code form,
  127. '   or for personal or business use in a non-source code binary executable.
  128. '   All other redistributions are prohibited without express written consent
  129. '   from John Allan Lee.
  130. '
  131. '/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\
  132. '/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\_/=\
  133.  
  134. Option Explicit
  135.  
  136. '=======================================================================
  137. ' needed for Enhancements
  138. Private Const LVIS_STATEIMAGEMASK As Long = &HF000
  139.  
  140. Private Type LVITEM
  141.     mask         As Long
  142.     iItem        As Long
  143.     iSubItem     As Long
  144.     state        As Long
  145.     stateMask    As Long
  146.     pszText      As String
  147.     cchTextMax   As Long
  148.     iImage       As Long
  149.     lParam       As Long
  150.     iIndent      As Long
  151. End Type
  152.  
  153. Const SWP_DRAWFRAME = &H20
  154. Const SWP_NOMOVE = &H2
  155. Const SWP_NOSIZE = &H1
  156. Const SWP_NOZORDER = &H4
  157.  
  158. Private Const LVS_EX_FULLROWSELECT = &H20
  159. Private Const LVS_EX_GRIDLINES = &H1
  160. Private Const LVS_EX_CHECKBOXES As Long = &H4
  161. Private Const LVS_EX_HEADERDRAGDROP = &H10
  162. Private Const LVS_EX_TRACKSELECT = &H8
  163. Private Const LVS_EX_ONECLICKACTIVATE = &H40
  164. Private Const LVS_EX_TWOCLICKACTIVATE = &H80
  165. Private Const LVS_EX_SUBITEMIMAGES = &H2
  166.  
  167. Private Const LVM_FIRST = &H1000
  168. Private Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
  169. Private Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
  170. Private Const LVM_GETHEADER = (LVM_FIRST + 31)
  171.  
  172. Public Const LVIF_STATE = &H8
  173. Public Const LVM_SETITEMSTATE = (LVM_FIRST + 43)
  174. Public Const LVM_GETITEMSTATE As Long = (LVM_FIRST + 44)
  175.  
  176. Private Const HDS_BUTTONS = &H2
  177. Private Const GWL_STYLE = (-16)
  178.  
  179. Private Const SWP_FLAGS = SWP_NOZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or SWP_DRAWFRAME
  180.  
  181. Public Declare Function SendMessageAny _
  182.                         Lib "user32" _
  183.                         Alias "SendMessageA" _
  184.                         (ByVal hwnd As Long, _
  185.                         ByVal Msg As Long, _
  186.                         ByVal wParam As Long, _
  187.                         lParam As Any) _
  188.                         As Long
  189.  
  190. Private Declare Function SendMessageLong Lib _
  191.                         "user32" Alias _
  192.                         "SendMessageA" _
  193.                         (ByVal hwnd As Long, _
  194.                         ByVal Msg As Long, _
  195.                         ByVal wParam As Long, _
  196.                         ByVal lParam As Long) _
  197.                         As Long
  198.                         
  199. Private Declare Function GetWindowLong _
  200.                         Lib "user32" _
  201.                         Alias "GetWindowLongA" _
  202.                         (ByVal hwnd As Long, _
  203.                         ByVal nIndex As Long) _
  204.                         As Long
  205.                         
  206. Private Declare Function SetWindowLong _
  207.                         Lib "user32" _
  208.                         Alias "SetWindowLongA" _
  209.                         (ByVal hwnd As Long, _
  210.                         ByVal nIndex As Long, _
  211.                         ByVal dwNewLong As Long) _
  212.                         As Long
  213.                         
  214. Private Declare Function SetWindowPos _
  215.                         Lib "user32" _
  216.                         (ByVal hwnd As Long, _
  217.                         ByVal hWndInsertAfter As Long, _
  218.                         ByVal x As Long, _
  219.                         ByVal Y As Long, _
  220.                         ByVal cx As Long, _
  221.                         ByVal cy As Long, _
  222.                         ByVal wFlags As Long) _
  223.                         As Long
  224. '=======================================================================
  225.  
  226. '=======================================================================
  227. Public LengthPerCharacter As Long
  228. '=======================================================================
  229.  
  230. '=======================================================================
  231. ' Description: Resizes all Columns in a ListView to fit the text in
  232. '              the rows
  233. '=======================================================================
  234. Public Function EnhListView_ResizeColumns( _
  235.                 lstListViewName As ListView, _
  236.                 Optional bolShowErrors As Boolean) _
  237.                 As Boolean
  238.     
  239.     '_______________________________________________________________________
  240.     ' initiate error handler
  241.     On Error GoTo err_EnhListView_ResizeColumns
  242.     
  243.     '_______________________________________________________________________
  244.     ' set function return to true
  245.     EnhListView_ResizeColumns = True
  246.     
  247.     '_______________________________________________________________________
  248.     ' if the user has not set LengthPerCharacter use 80
  249.     If LengthPerCharacter = 0 Then LengthPerCharacter = "80"
  250.     
  251.     '_______________________________________________________________________
  252.     ' if there are columns to go through...
  253.     If lstListViewName.ListItems.Count > 0 Then
  254.         ' setup variables
  255.         Dim lngIndexCounter As Long
  256.         Dim lngColumnCounter As Long
  257.         ' move through each column
  258.         For lngColumnCounter = 1 To lstListViewName.ColumnHeaders.Count
  259.             ' move though each entry
  260.             For lngIndexCounter = 1 To lstListViewName.ListItems.Count
  261.                 ' if it is not the first column
  262.                 If lngColumnCounter > 1 Then
  263.                     ' size the column 85 twips per letter
  264.                     If Len(lstListViewName.ListItems.Item(lngIndexCounter).SubItems(lngColumnCounter - 1)) * LengthPerCharacter > _
  265.                     lstListViewName.ColumnHeaders.Item(lngColumnCounter).Width Then
  266.                         lstListViewName.ColumnHeaders.Item(lngColumnCounter).Width = _
  267.                         Len(lstListViewName.ListItems.Item(lngIndexCounter).SubItems(lngColumnCounter - 1)) * LengthPerCharacter
  268.                     End If
  269.                 ' if it is the first column
  270.                 Else
  271.                     ' size the column 85 twips per letter
  272.                     If Len(lstListViewName.ListItems.Item(lngIndexCounter).Text) * LengthPerCharacter > _
  273.                     lstListViewName.ColumnHeaders.Item(lngColumnCounter).Width Then
  274.                         lstListViewName.ColumnHeaders.Item(lngColumnCounter).Width = _
  275.                         Len(lstListViewName.ListItems.Item(lngIndexCounter).Text) * LengthPerCharacter
  276.                     End If
  277.                 End If
  278.             Next lngIndexCounter
  279.         Next lngColumnCounter
  280.     End If
  281.     
  282.     '_______________________________________________________________________
  283.     ' exit before error handler
  284.     Exit Function
  285.     
  286. '_______________________________________________________________________
  287. ' deal with errors
  288. err_EnhListView_ResizeColumns:
  289.     
  290.     '_______________________________________________________________________
  291.     ' set function return to false
  292.     EnhListView_ResizeColumns = False
  293.     '_______________________________________________________________________
  294.     ' if you want notification on an error
  295.     If bolShowErrors = True Then
  296.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  297.                vbOKOnly + vbInformation, _
  298.                "Error in Function : EnhListView_ResizeColumns"
  299.     End If
  300.     
  301.     '_______________________________________________________________________
  302.     ' initiate debug
  303.     Debug.Print Now & vbTab & "Error in function: EnhListView_ResizeColumns" _
  304.                 & vbCrLf & _
  305.                 Err.Number & vbTab & Err.Description
  306.     Debug.Assert False
  307.     
  308.     '_______________________________________________________________________
  309.     ' exit
  310.     Exit Function
  311.     
  312. End Function
  313. '=======================================================================
  314.  
  315. '=======================================================================
  316. ' Description: Use on ColumnClick to sort by that Column
  317. '              Toggles between Ascending and Descending Sorts
  318. '=======================================================================
  319. Public Function EnhListView_SortColumns( _
  320.                 lstListViewName As ListView, _
  321.                 usdColIndex, _
  322.                 Optional bolShowErrors As Boolean) _
  323.                 As Boolean
  324.     
  325.     '_______________________________________________________________________
  326.     ' initiate error handler
  327.     On Error GoTo err_EnhListView_SortColumns
  328.     
  329.     '_______________________________________________________________________
  330.     ' set function return to true
  331.     EnhListView_SortColumns = True
  332.     
  333.     '_______________________________________________________________________
  334.     ' if there are columns to go through...
  335.     If lstListViewName.ListItems.Count > 0 Then
  336.         ' if the sort property is turned off turn it on
  337.         If lstListViewName.Sorted = False Then lstListViewName.Sorted = True
  338.         ' set the sortby column
  339.         lstListViewName.SortKey = _
  340.             lstListViewName.ColumnHeaders.Item(usdColIndex).Index - 1
  341.         ' if it's sorted ascending
  342.         If lstListViewName.SortOrder = lvwAscending Then
  343.             ' sort it descending
  344.             lstListViewName.SortOrder = lvwDescending
  345.         ' if it's sorted descending
  346.         Else
  347.             ' sort it ascending
  348.             lstListViewName.SortOrder = lvwAscending
  349.         End If
  350.     End If
  351.     
  352.     '_______________________________________________________________________
  353.     ' exit before error handler
  354.     Exit Function
  355.     
  356. '_______________________________________________________________________
  357. ' deal with errors
  358. err_EnhListView_SortColumns:
  359.     
  360.     '_______________________________________________________________________
  361.     ' set function return to false
  362.     EnhListView_SortColumns = False
  363.     '_______________________________________________________________________
  364.     ' if you want notification on an error
  365.     If bolShowErrors = True Then
  366.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  367.                vbOKOnly + vbInformation, _
  368.                "Error in Function : EnhListView_SortColumns"
  369.     End If
  370.     
  371.     '_______________________________________________________________________
  372.     ' initiate debug
  373.     Debug.Print Now & vbTab & "Error in function: EnhListView_SortColumns" _
  374.                 & vbCrLf & _
  375.                 Err.Number & vbTab & Err.Description
  376.     Debug.Assert False
  377.     
  378.     '_______________________________________________________________________
  379.     ' exit
  380.     Exit Function
  381.     
  382. End Function
  383. '=======================================================================
  384.  
  385. '=======================================================================
  386. ' Description: Resizes all Columns in a ListView to the Text in the
  387. '              Column Caption
  388. '=======================================================================
  389. Public Function EnhListView_ResizeColumnCaptions( _
  390.                 lstListViewName As ListView, _
  391.                 Optional bolShowErrors As Boolean) _
  392.                 As Boolean
  393.     
  394.     '_______________________________________________________________________
  395.     ' initiate error handler
  396.     On Error GoTo err_EnhListView_ResizeColumnCaptions
  397.     
  398.     '_______________________________________________________________________
  399.     ' set function return to true
  400.     EnhListView_ResizeColumnCaptions = True
  401.     
  402.     '_______________________________________________________________________
  403.     ' if the user has not set LengthPerCharacter use 80
  404.     If LengthPerCharacter = 0 Then LengthPerCharacter = "80"
  405.     
  406.     '_______________________________________________________________________
  407.     ' if there are columns to go through...
  408.     If lstListViewName.ListItems.Count > 0 Then
  409.         ' setup variables
  410.         Dim lngColumnCounter As Long
  411.         ' move through each column
  412.         For lngColumnCounter = 1 To lstListViewName.ColumnHeaders.Count
  413.             ' make the size of the column equal to 85 twips per character
  414.             lstListViewName.ColumnHeaders.Item(lngColumnCounter).Width = _
  415.             Len(lstListViewName.ColumnHeaders.Item(lngColumnCounter).Text) * LengthPerCharacter
  416.         Next lngColumnCounter
  417.     End If
  418.     
  419.     '_______________________________________________________________________
  420.     ' exit before error handler
  421.     Exit Function
  422.     
  423. '_______________________________________________________________________
  424. ' deal with errors
  425. err_EnhListView_ResizeColumnCaptions:
  426.     
  427.     '_______________________________________________________________________
  428.     ' set function return to false
  429.     EnhListView_ResizeColumnCaptions = False
  430.     '_______________________________________________________________________
  431.     ' if you want notification on an error
  432.     If bolShowErrors = True Then
  433.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  434.                vbOKOnly + vbInformation, _
  435.                "Error in Function : EnhListView_ResizeColumnCaptions"
  436.     End If
  437.     
  438.     '_______________________________________________________________________
  439.     ' initiate debug
  440.     Debug.Print Now & vbTab & "Error in function: EnhListView_ResizeColumnCaptions" _
  441.                 & vbCrLf & _
  442.                 Err.Number & vbTab & Err.Description
  443.     Debug.Assert False
  444.     
  445.     '_______________________________________________________________________
  446.     ' exit
  447.     Exit Function
  448.     
  449. End Function
  450. '=======================================================================
  451.  
  452. '=======================================================================
  453. ' Description: Resizes the ColumnHeaders in a ListView to the Width
  454. '              of the ListView
  455. '=======================================================================
  456. Public Function EnhListView_ResizeColumnHeaders( _
  457.                 lstListViewName As ListView, _
  458.                 Optional bolShowErrors As Boolean) _
  459.                 As Boolean
  460.     
  461.     '________________________________________________________________________
  462.     ' initiate error handler
  463.     On Error GoTo err_EnhListView_ResizeColumnHeaders
  464.     
  465.     '________________________________________________________________________
  466.     ' set function return to true
  467.     EnhListView_ResizeColumnHeaders = True
  468.     
  469.     '________________________________________________________________________
  470.     ' setup variables
  471.     Dim lngColCounter As Long
  472.     Dim lngListViewDiv As Long
  473.     
  474.     '________________________________________________________________________
  475.     ' fill variables
  476.     lngListViewDiv = lstListViewName.Width / lstListViewName.ColumnHeaders.Count - 300
  477.     
  478.     '________________________________________________________________________
  479.     For lngColCounter = 1 To lstListViewName.ColumnHeaders.Count
  480.         lstListViewName.ColumnHeaders(lngColCounter).Width = lngListViewDiv
  481.     Next lngColCounter
  482.     
  483.     '________________________________________________________________________
  484.     ' exit before error handler
  485.     Exit Function
  486.     
  487. '________________________________________________________________________
  488. ' deal with errors
  489. err_EnhListView_ResizeColumnHeaders:
  490.     
  491.     '________________________________________________________________________
  492.     ' set function return to false
  493.     EnhListView_ResizeColumnHeaders = False
  494.     '________________________________________________________________________
  495.     ' if you want notification on an error
  496.     If bolShowErrors = True Then
  497.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  498.                vbOKOnly + vbInformation, _
  499.                "Error in Function : EnhListView_ResizeColumnHeaders"
  500.     End If
  501.     
  502.     '________________________________________________________________________
  503.     ' initiate debug
  504.     Debug.Print Now & vbTab & "Error in function: EnhListView_ResizeColumnHeaders" _
  505.                 & vbCrLf & _
  506.                 Err.Number & vbTab & Err.Description
  507.     Debug.Assert False
  508.     
  509.     '________________________________________________________________________
  510.     ' exit
  511.     Exit Function
  512.     
  513. End Function
  514. '=======================================================================
  515.  
  516. '=======================================================================
  517. ' Description: Enables Full Row Select in a ListView
  518. '=======================================================================
  519. Public Function EnhListView_Add_FullRowSelect( _
  520.                 lstListViewName As ListView, _
  521.                 Optional bolShowErrors As Boolean) _
  522.                 As Boolean
  523.     
  524.     '________________________________________________________________________
  525.     ' initiate error handler
  526.     On Error GoTo err_EnhListView_Add_FullRowSelect
  527.     
  528.     '________________________________________________________________________
  529.     ' set function return to true
  530.     EnhListView_Add_FullRowSelect = True
  531.     
  532.     '________________________________________________________________________
  533.     ' setup variables
  534.     Dim rStyle  As Long
  535.     Dim r       As Long
  536.     
  537.     '________________________________________________________________________
  538.     ' get the current styles
  539.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  540.     
  541.     '________________________________________________________________________
  542.     ' add the selected style to the current styles
  543.     rStyle = rStyle Or LVS_EX_FULLROWSELECT
  544.     
  545.     '________________________________________________________________________
  546.     ' update the listview styles
  547.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  548.     
  549.     '________________________________________________________________________
  550.     ' exit before error handler
  551.     Exit Function
  552.     
  553. '________________________________________________________________________
  554. ' deal with errors
  555. err_EnhListView_Add_FullRowSelect:
  556.     
  557.     '________________________________________________________________________
  558.     ' set function return to false
  559.     EnhListView_Add_FullRowSelect = False
  560.     '________________________________________________________________________
  561.     ' if you want notification on an error
  562.     If bolShowErrors = True Then
  563.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  564.                vbOKOnly + vbInformation, _
  565.                "Error in Function : EnhListView_Add_FullRowSelect"
  566.     End If
  567.     
  568.     '________________________________________________________________________
  569.     ' initiate debug
  570.     Debug.Print Now & vbTab & "Error in function: EnhListView_Add_FullRowSelect" _
  571.                 & vbCrLf & _
  572.                 Err.Number & vbTab & Err.Description
  573.     Debug.Assert False
  574.     
  575.     '________________________________________________________________________
  576.     ' exit
  577.     Exit Function
  578.     
  579. End Function
  580. '=======================================================================
  581.  
  582. '=======================================================================
  583. ' Description: Disables Full Row Select in a ListView
  584. '=======================================================================
  585. Public Function EnhListView_Rem_FullRowSelect( _
  586.                 lstListViewName As ListView, _
  587.                 Optional bolShowErrors As Boolean) _
  588.                 As Boolean
  589.     
  590.     '________________________________________________________________________
  591.     ' initiate error handler
  592.     On Error GoTo err_EnhListView_Rem_FullRowSelect
  593.     
  594.     '________________________________________________________________________
  595.     ' set function return to true
  596.     EnhListView_Rem_FullRowSelect = True
  597.     
  598.     '________________________________________________________________________
  599.     ' setup variables
  600.     Dim rStyle  As Long
  601.     Dim r       As Long
  602.     
  603.     '________________________________________________________________________
  604.     ' get the current styles
  605.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  606.     
  607.     '________________________________________________________________________
  608.     ' remove the selected style from the current styles
  609.     rStyle = rStyle Xor LVS_EX_FULLROWSELECT
  610.     
  611.     '________________________________________________________________________
  612.     ' update the listview styles
  613.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  614.     
  615.     '________________________________________________________________________
  616.     ' exit before error handler
  617.     Exit Function
  618.     
  619. '________________________________________________________________________
  620. ' deal with errors
  621. err_EnhListView_Rem_FullRowSelect:
  622.     
  623.     '________________________________________________________________________
  624.     ' set function return to false
  625.     EnhListView_Rem_FullRowSelect = False
  626.     '________________________________________________________________________
  627.     ' if you want notification on an error
  628.     If bolShowErrors = True Then
  629.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  630.                vbOKOnly + vbInformation, _
  631.                "Error in Function : EnhListView_Rem_FullRowSelect"
  632.     End If
  633.     
  634.     '________________________________________________________________________
  635.     ' initiate debug
  636.     Debug.Print Now & vbTab & "Error in function: EnhListView_Rem_FullRowSelect" _
  637.                 & vbCrLf & _
  638.                 Err.Number & vbTab & Err.Description
  639.     Debug.Assert False
  640.     
  641.     '________________________________________________________________________
  642.     ' exit
  643.     Exit Function
  644.     
  645. End Function
  646. '=======================================================================
  647.  
  648. '=======================================================================
  649. ' Description: Enables GridLines in a ListView
  650. '=======================================================================
  651. Public Function EnhListView_Add_GridLines( _
  652.                 lstListViewName As ListView, _
  653.                 Optional bolShowErrors As Boolean) _
  654.                 As Boolean
  655.     
  656.     '________________________________________________________________________
  657.     ' initiate error handler
  658.     On Error GoTo err_EnhListView_Add_GridLines
  659.     
  660.     '________________________________________________________________________
  661.     ' set function return to true
  662.     EnhListView_Add_GridLines = True
  663.     
  664.     '________________________________________________________________________
  665.     ' setup variables
  666.     Dim rStyle  As Long
  667.     Dim r       As Long
  668.     
  669.     '________________________________________________________________________
  670.     ' get the current styles
  671.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  672.     
  673.     '________________________________________________________________________
  674.     ' add the selected style to the current styles
  675.     rStyle = rStyle Or LVS_EX_GRIDLINES
  676.     
  677.     '________________________________________________________________________
  678.     ' update the listview styles
  679.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  680.     
  681.     '________________________________________________________________________
  682.     ' exit before error handler
  683.     Exit Function
  684.     
  685. '________________________________________________________________________
  686. ' deal with errors
  687. err_EnhListView_Add_GridLines:
  688.     
  689.     '________________________________________________________________________
  690.     ' set function return to false
  691.     EnhListView_Add_GridLines = False
  692.     '________________________________________________________________________
  693.     ' if you want notification on an error
  694.     If bolShowErrors = True Then
  695.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  696.                vbOKOnly + vbInformation, _
  697.                "Error in Function : EnhListView_Add_GridLines"
  698.     End If
  699.     
  700.     '________________________________________________________________________
  701.     ' initiate debug
  702.     Debug.Print Now & vbTab & "Error in function: EnhListView_Add_GridLines" _
  703.                 & vbCrLf & _
  704.                 Err.Number & vbTab & Err.Description
  705.     Debug.Assert False
  706.     
  707.     '________________________________________________________________________
  708.     ' exit
  709.     Exit Function
  710.     
  711. End Function
  712. '=======================================================================
  713.  
  714. '=======================================================================
  715. ' Description: Disables GridLines in a ListView
  716. '=======================================================================
  717. Public Function EnhListView_Rem_GridLines( _
  718.                 lstListViewName As ListView, _
  719.                 Optional bolShowErrors As Boolean) _
  720.                 As Boolean
  721.     
  722.     '________________________________________________________________________
  723.     ' initiate error handler
  724.     On Error GoTo err_EnhListView_Rem_GridLines
  725.     
  726.     '________________________________________________________________________
  727.     ' set function return to true
  728.     EnhListView_Rem_GridLines = True
  729.     
  730.     '________________________________________________________________________
  731.     ' setup variables
  732.     Dim rStyle  As Long
  733.     Dim r       As Long
  734.     
  735.     '________________________________________________________________________
  736.     ' get the current styles
  737.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  738.     
  739.     '________________________________________________________________________
  740.     ' remove the selected style from the current styles
  741.     rStyle = rStyle Xor LVS_EX_GRIDLINES
  742.     
  743.     '________________________________________________________________________
  744.     ' update the listview styles
  745.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  746.     
  747.     '________________________________________________________________________
  748.     ' exit before error handler
  749.     Exit Function
  750.     
  751. '________________________________________________________________________
  752. ' deal with errors
  753. err_EnhListView_Rem_GridLines:
  754.     
  755.     '________________________________________________________________________
  756.     ' set function return to false
  757.     EnhListView_Rem_GridLines = False
  758.     '________________________________________________________________________
  759.     ' if you want notification on an error
  760.     If bolShowErrors = True Then
  761.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  762.                vbOKOnly + vbInformation, _
  763.                "Error in Function : EnhListView_Rem_GridLines"
  764.     End If
  765.     
  766.     '________________________________________________________________________
  767.     ' initiate debug
  768.     Debug.Print Now & vbTab & "Error in function: EnhListView_Rem_GridLines" _
  769.                 & vbCrLf & _
  770.                 Err.Number & vbTab & Err.Description
  771.     Debug.Assert False
  772.     
  773.     '________________________________________________________________________
  774.     ' exit
  775.     Exit Function
  776.     
  777. End Function
  778. '=======================================================================
  779.  
  780. '=======================================================================
  781. ' Description: Enables CheckBoxes in a ListView
  782. '=======================================================================
  783. Public Function EnhListView_Add_CheckBoxes( _
  784.                 lstListViewName As ListView, _
  785.                 Optional bolShowErrors As Boolean) _
  786.                 As Boolean
  787.     
  788.     '________________________________________________________________________
  789.     ' initiate error handler
  790.     On Error GoTo err_EnhListView_Add_CheckBoxes
  791.     
  792.     '________________________________________________________________________
  793.     ' set function return to true
  794.     EnhListView_Add_CheckBoxes = True
  795.     
  796.     '________________________________________________________________________
  797.     ' setup variables
  798.     Dim rStyle  As Long
  799.     Dim r       As Long
  800.     
  801.     '________________________________________________________________________
  802.     ' get the current styles
  803.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  804.     
  805.     '________________________________________________________________________
  806.     ' add the selected style to the current styles
  807.     rStyle = rStyle Or LVS_EX_CHECKBOXES
  808.     
  809.     '________________________________________________________________________
  810.     ' update the listview styles
  811.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  812.     
  813.     '________________________________________________________________________
  814.     ' exit before error handler
  815.     Exit Function
  816.     
  817. '________________________________________________________________________
  818. ' deal with errors
  819. err_EnhListView_Add_CheckBoxes:
  820.     
  821.     '________________________________________________________________________
  822.     ' set function return to false
  823.     EnhListView_Add_CheckBoxes = False
  824.     '________________________________________________________________________
  825.     ' if you want notification on an error
  826.     If bolShowErrors = True Then
  827.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  828.                vbOKOnly + vbInformation, _
  829.                "Error in Function : EnhListView_Add_CheckBoxes"
  830.     End If
  831.     
  832.     '________________________________________________________________________
  833.     ' initiate debug
  834.     Debug.Print Now & vbTab & "Error in function: EnhListView_Add_CheckBoxes" _
  835.                 & vbCrLf & _
  836.                 Err.Number & vbTab & Err.Description
  837.     Debug.Assert False
  838.     
  839.     '________________________________________________________________________
  840.     ' exit
  841.     Exit Function
  842.     
  843. End Function
  844. '=======================================================================
  845.  
  846. '=======================================================================
  847. ' Description: Disables CheckBoxes in a ListView
  848. '=======================================================================
  849. Public Function EnhListView_Rem_CheckBoxes( _
  850.                 lstListViewName As ListView, _
  851.                 Optional bolShowErrors As Boolean) _
  852.                 As Boolean
  853.     
  854.     '________________________________________________________________________
  855.     ' initiate error handler
  856.     On Error GoTo err_EnhListView_Rem_CheckBoxes
  857.     
  858.     '________________________________________________________________________
  859.     ' set function return to true
  860.     EnhListView_Rem_CheckBoxes = True
  861.     
  862.     '________________________________________________________________________
  863.     ' setup variables
  864.     Dim rStyle  As Long
  865.     Dim r       As Long
  866.     
  867.     '________________________________________________________________________
  868.     ' get the current styles
  869.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  870.     
  871.     '________________________________________________________________________
  872.     ' add the selected style to the current styles
  873.     rStyle = rStyle Xor LVS_EX_CHECKBOXES
  874.     
  875.     '________________________________________________________________________
  876.     ' update the listview styles
  877.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  878.     
  879.     '________________________________________________________________________
  880.     ' exit before error handler
  881.     Exit Function
  882.     
  883. '________________________________________________________________________
  884. ' deal with errors
  885. err_EnhListView_Rem_CheckBoxes:
  886.     
  887.     '________________________________________________________________________
  888.     ' set function return to false
  889.     EnhListView_Rem_CheckBoxes = False
  890.     '________________________________________________________________________
  891.     ' if you want notification on an error
  892.     If bolShowErrors = True Then
  893.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  894.                vbOKOnly + vbInformation, _
  895.                "Error in Function : EnhListView_Rem_CheckBoxes"
  896.     End If
  897.     
  898.     '________________________________________________________________________
  899.     ' initiate debug
  900.     Debug.Print Now & vbTab & "Error in function: EnhListView_Rem_CheckBoxes" _
  901.                 & vbCrLf & _
  902.                 Err.Number & vbTab & Err.Description
  903.     Debug.Assert False
  904.     
  905.     '________________________________________________________________________
  906.     ' exit
  907.     Exit Function
  908.     
  909. End Function
  910. '=======================================================================
  911.  
  912. '=======================================================================
  913. ' Description: Enables Repositioning of ColumnHeaders in a ListView
  914. '=======================================================================
  915. Public Function EnhListView_Add_AllowRepositioning( _
  916.                 lstListViewName As ListView, _
  917.                 Optional bolShowErrors As Boolean) _
  918.                 As Boolean
  919.     
  920.     '________________________________________________________________________
  921.     ' initiate error handler
  922.     On Error GoTo err_EnhListView_Add_AllowRepositioning
  923.     
  924.     '________________________________________________________________________
  925.     ' set function return to true
  926.     EnhListView_Add_AllowRepositioning = True
  927.     
  928.     '________________________________________________________________________
  929.     ' setup variables
  930.     Dim rStyle  As Long
  931.     Dim r       As Long
  932.     
  933.     '________________________________________________________________________
  934.     ' get the current styles
  935.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  936.     
  937.     '________________________________________________________________________
  938.     ' add the selected style to the current styles
  939.     rStyle = rStyle Or LVS_EX_HEADERDRAGDROP
  940.     
  941.     '________________________________________________________________________
  942.     ' update the listview styles
  943.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  944.     
  945.     '________________________________________________________________________
  946.     ' exit before error handler
  947.     Exit Function
  948.     
  949. '________________________________________________________________________
  950. ' deal with errors
  951. err_EnhListView_Add_AllowRepositioning:
  952.     
  953.     '________________________________________________________________________
  954.     ' set function return to false
  955.     EnhListView_Add_AllowRepositioning = False
  956.     '________________________________________________________________________
  957.     ' if you want notification on an error
  958.     If bolShowErrors = True Then
  959.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  960.                vbOKOnly + vbInformation, _
  961.                "Error in Function : EnhListView_Add_AllowRepositioning"
  962.     End If
  963.     
  964.     '________________________________________________________________________
  965.     ' initiate debug
  966.     Debug.Print Now & vbTab & "Error in function: EnhListView_Add_AllowRepositioning" _
  967.                 & vbCrLf & _
  968.                 Err.Number & vbTab & Err.Description
  969.     Debug.Assert False
  970.     
  971.     '________________________________________________________________________
  972.     ' exit
  973.     Exit Function
  974.     
  975. End Function
  976. '=======================================================================
  977.  
  978. '=======================================================================
  979. ' Description: Disables Repositioning of ColumnHeaders in a ListView
  980. '=======================================================================
  981. Public Function EnhListView_Rem_AllowRepositioning( _
  982.                 lstListViewName As ListView, _
  983.                 Optional bolShowErrors As Boolean) _
  984.                 As Boolean
  985.     
  986.     '________________________________________________________________________
  987.     ' initiate error handler
  988.     On Error GoTo err_EnhListView_Rem_AllowRepositioning
  989.     
  990.     '________________________________________________________________________
  991.     ' set function return to true
  992.     EnhListView_Rem_AllowRepositioning = True
  993.     
  994.     '________________________________________________________________________
  995.     ' setup variables
  996.     Dim rStyle  As Long
  997.     Dim r       As Long
  998.     
  999.     '________________________________________________________________________
  1000.     ' get the current styles
  1001.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  1002.     
  1003.     '________________________________________________________________________
  1004.     ' add the selected style to the current styles
  1005.     rStyle = rStyle Xor LVS_EX_HEADERDRAGDROP
  1006.     
  1007.     '________________________________________________________________________
  1008.     ' update the listview styles
  1009.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  1010.     
  1011.     '________________________________________________________________________
  1012.     ' exit before error handler
  1013.     Exit Function
  1014.     
  1015. '________________________________________________________________________
  1016. ' deal with errors
  1017. err_EnhListView_Rem_AllowRepositioning:
  1018.     
  1019.     '________________________________________________________________________
  1020.     ' set function return to false
  1021.     EnhListView_Rem_AllowRepositioning = False
  1022.     '________________________________________________________________________
  1023.     ' if you want notification on an error
  1024.     If bolShowErrors = True Then
  1025.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1026.                vbOKOnly + vbInformation, _
  1027.                "Error in Function : EnhListView_Rem_AllowRepositioning"
  1028.     End If
  1029.     
  1030.     '________________________________________________________________________
  1031.     ' initiate debug
  1032.     Debug.Print Now & vbTab & "Error in function: EnhListView_Rem_AllowRepositioning" _
  1033.                 & vbCrLf & _
  1034.                 Err.Number & vbTab & Err.Description
  1035.     Debug.Assert False
  1036.     
  1037.     '________________________________________________________________________
  1038.     ' exit
  1039.     Exit Function
  1040.     
  1041. End Function
  1042. '=======================================================================
  1043.  
  1044. '=======================================================================
  1045. ' Description: Enables TrackSelected in a ListView
  1046. '=======================================================================
  1047. Public Function EnhListView_Add_TrackSelected( _
  1048.                 lstListViewName As ListView, _
  1049.                 Optional bolShowErrors As Boolean) _
  1050.                 As Boolean
  1051.     
  1052.     '________________________________________________________________________
  1053.     ' initiate error handler
  1054.     On Error GoTo err_EnhListView_Add_TrackSelected
  1055.     
  1056.     '________________________________________________________________________
  1057.     ' set function return to true
  1058.     EnhListView_Add_TrackSelected = True
  1059.     
  1060.     '________________________________________________________________________
  1061.     ' setup variables
  1062.     Dim rStyle  As Long
  1063.     Dim r       As Long
  1064.     
  1065.     '________________________________________________________________________
  1066.     ' get the current styles
  1067.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  1068.     
  1069.     '________________________________________________________________________
  1070.     ' add the selected style to the current styles
  1071.     rStyle = rStyle Or LVS_EX_TRACKSELECT
  1072.     
  1073.     '________________________________________________________________________
  1074.     ' update the listview styles
  1075.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  1076.     
  1077.     '________________________________________________________________________
  1078.     ' exit before error handler
  1079.     Exit Function
  1080.     
  1081. '________________________________________________________________________
  1082. ' deal with errors
  1083. err_EnhListView_Add_TrackSelected:
  1084.     
  1085.     '________________________________________________________________________
  1086.     ' set function return to false
  1087.     EnhListView_Add_TrackSelected = False
  1088.     '________________________________________________________________________
  1089.     ' if you want notification on an error
  1090.     If bolShowErrors = True Then
  1091.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1092.                vbOKOnly + vbInformation, _
  1093.                "Error in Function : EnhListView_Add_TrackSelected"
  1094.     End If
  1095.     
  1096.     '________________________________________________________________________
  1097.     ' initiate debug
  1098.     Debug.Print Now & vbTab & "Error in function: EnhListView_Add_TrackSelected" _
  1099.                 & vbCrLf & _
  1100.                 Err.Number & vbTab & Err.Description
  1101.     Debug.Assert False
  1102.     
  1103.     '________________________________________________________________________
  1104.     ' exit
  1105.     Exit Function
  1106.     
  1107. End Function
  1108. '=======================================================================
  1109.  
  1110. '=======================================================================
  1111. ' Description: Disables TrackSelected in a ListView
  1112. '=======================================================================
  1113. Public Function EnhListView_Rem_TrackSelected( _
  1114.                 lstListViewName As ListView, _
  1115.                 Optional bolShowErrors As Boolean) _
  1116.                 As Boolean
  1117.     
  1118.     '________________________________________________________________________
  1119.     ' initiate error handler
  1120.     On Error GoTo err_EnhListView_Rem_TrackSelected
  1121.     
  1122.     '________________________________________________________________________
  1123.     ' set function return to true
  1124.     EnhListView_Rem_TrackSelected = True
  1125.     
  1126.     '________________________________________________________________________
  1127.     ' setup variables
  1128.     Dim rStyle  As Long
  1129.     Dim r       As Long
  1130.     
  1131.     '________________________________________________________________________
  1132.     ' get the current styles
  1133.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  1134.     
  1135.     '________________________________________________________________________
  1136.     ' add the selected style to the current styles
  1137.     rStyle = rStyle Xor LVS_EX_TRACKSELECT
  1138.     
  1139.     '________________________________________________________________________
  1140.     ' update the listview styles
  1141.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  1142.     
  1143.     
  1144.     '________________________________________________________________________
  1145.     ' exit before error handler
  1146.     Exit Function
  1147.     
  1148. '________________________________________________________________________
  1149. ' deal with errors
  1150. err_EnhListView_Rem_TrackSelected:
  1151.     
  1152.     '________________________________________________________________________
  1153.     ' set function return to false
  1154.     EnhListView_Rem_TrackSelected = False
  1155.     '________________________________________________________________________
  1156.     ' if you want notification on an error
  1157.     If bolShowErrors = True Then
  1158.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1159.                vbOKOnly + vbInformation, _
  1160.                "Error in Function : EnhListView_Rem_TrackSelected"
  1161.     End If
  1162.     
  1163.     '________________________________________________________________________
  1164.     ' initiate debug
  1165.     Debug.Print Now & vbTab & "Error in function: EnhListView_Rem_TrackSelected" _
  1166.                 & vbCrLf & _
  1167.                 Err.Number & vbTab & Err.Description
  1168.     Debug.Assert False
  1169.     
  1170.     '________________________________________________________________________
  1171.     ' exit
  1172.     Exit Function
  1173.     
  1174. End Function
  1175. '=======================================================================
  1176.  
  1177. '=======================================================================
  1178. ' Description: Enables One Click Activate in a ListView
  1179. '=======================================================================
  1180. Public Function EnhListView_Add_OneClickActivate( _
  1181.                 lstListViewName As ListView, _
  1182.                 Optional bolShowErrors As Boolean) _
  1183.                 As Boolean
  1184.     
  1185.     '________________________________________________________________________
  1186.     ' initiate error handler
  1187.     On Error GoTo err_EnhListView_Add_OneClickActivate
  1188.     
  1189.     '________________________________________________________________________
  1190.     ' set function return to true
  1191.     EnhListView_Add_OneClickActivate = True
  1192.     
  1193.     '________________________________________________________________________
  1194.     ' setup variables
  1195.     Dim rStyle  As Long
  1196.     Dim r       As Long
  1197.     
  1198.     '________________________________________________________________________
  1199.     ' get the current styles
  1200.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  1201.     
  1202.     '________________________________________________________________________
  1203.     ' add the selected style to the current styles
  1204.     rStyle = rStyle Or LVS_EX_ONECLICKACTIVATE
  1205.     
  1206.     '________________________________________________________________________
  1207.     ' update the listview styles
  1208.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  1209.     
  1210.     '________________________________________________________________________
  1211.     ' exit before error handler
  1212.     Exit Function
  1213.     
  1214. '________________________________________________________________________
  1215. ' deal with errors
  1216. err_EnhListView_Add_OneClickActivate:
  1217.     
  1218.     '________________________________________________________________________
  1219.     ' set function return to false
  1220.     EnhListView_Add_OneClickActivate = False
  1221.     '________________________________________________________________________
  1222.     ' if you want notification on an error
  1223.     If bolShowErrors = True Then
  1224.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1225.                vbOKOnly + vbInformation, _
  1226.                "Error in Function : EnhListView_Add_OneClickActivate"
  1227.     End If
  1228.     
  1229.     '________________________________________________________________________
  1230.     ' initiate debug
  1231.     Debug.Print Now & vbTab & "Error in function: EnhListView_Add_OneClickActivate" _
  1232.                 & vbCrLf & _
  1233.                 Err.Number & vbTab & Err.Description
  1234.     Debug.Assert False
  1235.     
  1236.     '________________________________________________________________________
  1237.     ' exit
  1238.     Exit Function
  1239.     
  1240. End Function
  1241. '=======================================================================
  1242.  
  1243. '=======================================================================
  1244. ' Description: Disables One Click Activate in a ListView
  1245. '=======================================================================
  1246. Public Function EnhListView_Rem_OneClickActivate( _
  1247.                 lstListViewName As ListView, _
  1248.                 Optional bolShowErrors As Boolean) _
  1249.                 As Boolean
  1250.     
  1251.     '________________________________________________________________________
  1252.     ' initiate error handler
  1253.     On Error GoTo err_EnhListView_Rem_OneClickActivate
  1254.     
  1255.     '________________________________________________________________________
  1256.     ' set function return to true
  1257.     EnhListView_Rem_OneClickActivate = True
  1258.     
  1259.     '________________________________________________________________________
  1260.     ' setup variables
  1261.     Dim rStyle  As Long
  1262.     Dim r       As Long
  1263.     
  1264.     '________________________________________________________________________
  1265.     ' get the current styles
  1266.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  1267.     
  1268.     '________________________________________________________________________
  1269.     ' add the selected style to the current styles
  1270.     rStyle = rStyle Xor LVS_EX_ONECLICKACTIVATE
  1271.     
  1272.     '________________________________________________________________________
  1273.     ' update the listview styles
  1274.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  1275.     
  1276.     '________________________________________________________________________
  1277.     ' exit before error handler
  1278.     Exit Function
  1279.     
  1280. '________________________________________________________________________
  1281. ' deal with errors
  1282. err_EnhListView_Rem_OneClickActivate:
  1283.     
  1284.     '________________________________________________________________________
  1285.     ' set function return to false
  1286.     EnhListView_Rem_OneClickActivate = False
  1287.     '________________________________________________________________________
  1288.     ' if you want notification on an error
  1289.     If bolShowErrors = True Then
  1290.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1291.                vbOKOnly + vbInformation, _
  1292.                "Error in Function : EnhListView_Rem_OneClickActivate"
  1293.     End If
  1294.     
  1295.     '________________________________________________________________________
  1296.     ' initiate debug
  1297.     Debug.Print Now & vbTab & "Error in function: EnhListView_Rem_OneClickActivate" _
  1298.                 & vbCrLf & _
  1299.                 Err.Number & vbTab & Err.Description
  1300.     Debug.Assert False
  1301.     
  1302.     '________________________________________________________________________
  1303.     ' exit
  1304.     Exit Function
  1305.     
  1306. End Function
  1307. '=======================================================================
  1308.  
  1309. '=======================================================================
  1310. ' Description: Enables Two Click Activate in a ListView
  1311. '=======================================================================
  1312. Public Function EnhListView_Add_TwoClickActivate( _
  1313.                 lstListViewName As ListView, _
  1314.                 Optional bolShowErrors As Boolean) _
  1315.                 As Boolean
  1316.     
  1317.     '________________________________________________________________________
  1318.     ' initiate error handler
  1319.     On Error GoTo err_EnhListView_Add_TwoClickActivate
  1320.     
  1321.     '________________________________________________________________________
  1322.     ' set function return to true
  1323.     EnhListView_Add_TwoClickActivate = True
  1324.     
  1325.     '________________________________________________________________________
  1326.     ' setup variables
  1327.     Dim rStyle  As Long
  1328.     Dim r       As Long
  1329.     
  1330.     '________________________________________________________________________
  1331.     ' get the current styles
  1332.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  1333.     
  1334.     '________________________________________________________________________
  1335.     ' add the selected style to the current styles
  1336.     rStyle = rStyle Or LVS_EX_TWOCLICKACTIVATE
  1337.     
  1338.     '________________________________________________________________________
  1339.     ' update the listview styles
  1340.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  1341.     
  1342.     '________________________________________________________________________
  1343.     ' exit before error handler
  1344.     Exit Function
  1345.     
  1346. '________________________________________________________________________
  1347. ' deal with errors
  1348. err_EnhListView_Add_TwoClickActivate:
  1349.     
  1350.     '________________________________________________________________________
  1351.     ' set function return to false
  1352.     EnhListView_Add_TwoClickActivate = False
  1353.     '________________________________________________________________________
  1354.     ' if you want notification on an error
  1355.     If bolShowErrors = True Then
  1356.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1357.                vbOKOnly + vbInformation, _
  1358.                "Error in Function : EnhListView_Add_TwoClickActivate"
  1359.     End If
  1360.     
  1361.     '________________________________________________________________________
  1362.     ' initiate debug
  1363.     Debug.Print Now & vbTab & "Error in function: EnhListView_Add_TwoClickActivate" _
  1364.                 & vbCrLf & _
  1365.                 Err.Number & vbTab & Err.Description
  1366.     Debug.Assert False
  1367.     
  1368.     '________________________________________________________________________
  1369.     ' exit
  1370.     Exit Function
  1371.     
  1372. End Function
  1373. '=======================================================================
  1374.  
  1375. '=======================================================================
  1376. ' Description: Enables Full Row Select in a ListView
  1377. '=======================================================================
  1378. Public Function EnhListView_Rem_TwoClickActivate( _
  1379.                 lstListViewName As ListView, _
  1380.                 Optional bolShowErrors As Boolean) _
  1381.                 As Boolean
  1382.     
  1383.     '________________________________________________________________________
  1384.     ' initiate error handler
  1385.     On Error GoTo err_EnhListView_Rem_TwoClickActivate
  1386.     
  1387.     '________________________________________________________________________
  1388.     ' set function return to true
  1389.     EnhListView_Rem_TwoClickActivate = True
  1390.     
  1391.     '________________________________________________________________________
  1392.     ' setup variables
  1393.     Dim rStyle  As Long
  1394.     Dim r       As Long
  1395.     
  1396.     '________________________________________________________________________
  1397.     ' get the current styles
  1398.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  1399.     
  1400.     '________________________________________________________________________
  1401.     ' add the selected style to the current styles
  1402.     rStyle = rStyle Xor LVS_EX_TWOCLICKACTIVATE
  1403.     
  1404.     '________________________________________________________________________
  1405.     ' update the listview styles
  1406.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  1407.     
  1408.     '________________________________________________________________________
  1409.     ' exit before error handler
  1410.     Exit Function
  1411.     
  1412. '________________________________________________________________________
  1413. ' deal with errors
  1414. err_EnhListView_Rem_TwoClickActivate:
  1415.     
  1416.     '________________________________________________________________________
  1417.     ' set function return to false
  1418.     EnhListView_Rem_TwoClickActivate = False
  1419.     '________________________________________________________________________
  1420.     ' if you want notification on an error
  1421.     If bolShowErrors = True Then
  1422.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1423.                vbOKOnly + vbInformation, _
  1424.                "Error in Function : EnhListView_Rem_TwoClickActivate"
  1425.     End If
  1426.     
  1427.     '________________________________________________________________________
  1428.     ' initiate debug
  1429.     Debug.Print Now & vbTab & "Error in function: EnhListView_Rem_TwoClickActivate" _
  1430.                 & vbCrLf & _
  1431.                 Err.Number & vbTab & Err.Description
  1432.     Debug.Assert False
  1433.     
  1434.     '________________________________________________________________________
  1435.     ' exit
  1436.     Exit Function
  1437.     
  1438. End Function
  1439. '=======================================================================
  1440.  
  1441. '=======================================================================
  1442. ' Description: Enables SubItem Images in a ListView
  1443. '=======================================================================
  1444. Public Function EnhListView_Add_SubitemImages( _
  1445.                 lstListViewName As ListView, _
  1446.                 Optional bolShowErrors As Boolean) _
  1447.                 As Boolean
  1448.     
  1449.     '________________________________________________________________________
  1450.     ' initiate error handler
  1451.     On Error GoTo err_EnhListView_Add_SubitemImages
  1452.     
  1453.     '________________________________________________________________________
  1454.     ' set function return to true
  1455.     EnhListView_Add_SubitemImages = True
  1456.     
  1457.     '________________________________________________________________________
  1458.     ' setup variables
  1459.     Dim rStyle  As Long
  1460.     Dim r       As Long
  1461.     
  1462.     '________________________________________________________________________
  1463.     ' get the current styles
  1464.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  1465.     
  1466.     '________________________________________________________________________
  1467.     ' add the selected style to the current styles
  1468.     rStyle = rStyle Or LVS_EX_SUBITEMIMAGES
  1469.     
  1470.     '________________________________________________________________________
  1471.     ' update the listview styles
  1472.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  1473.     
  1474.     '________________________________________________________________________
  1475.     ' exit before error handler
  1476.     Exit Function
  1477.     
  1478. '________________________________________________________________________
  1479. ' deal with errors
  1480. err_EnhListView_Add_SubitemImages:
  1481.     
  1482.     '________________________________________________________________________
  1483.     ' set function return to false
  1484.     EnhListView_Add_SubitemImages = False
  1485.     '________________________________________________________________________
  1486.     ' if you want notification on an error
  1487.     If bolShowErrors = True Then
  1488.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1489.                vbOKOnly + vbInformation, _
  1490.                "Error in Function : EnhListView_Add_SubitemImages"
  1491.     End If
  1492.     
  1493.     '________________________________________________________________________
  1494.     ' initiate debug
  1495.     Debug.Print Now & vbTab & "Error in function: EnhListView_Add_SubitemImages" _
  1496.                 & vbCrLf & _
  1497.                 Err.Number & vbTab & Err.Description
  1498.     Debug.Assert False
  1499.     
  1500.     '________________________________________________________________________
  1501.     ' exit
  1502.     Exit Function
  1503.     
  1504. End Function
  1505. '=======================================================================
  1506.  
  1507. '=======================================================================
  1508. ' Description: Disables SubItem Images in a ListView
  1509. '=======================================================================
  1510. Public Function EnhListView_Rem_SubitemImages( _
  1511.                 lstListViewName As ListView, _
  1512.                 Optional bolShowErrors As Boolean) _
  1513.                 As Boolean
  1514.     
  1515.     '________________________________________________________________________
  1516.     ' initiate error handler
  1517.     On Error GoTo err_EnhListView_Rem_SubitemImages
  1518.     
  1519.     '________________________________________________________________________
  1520.     ' set function return to true
  1521.     EnhListView_Rem_SubitemImages = True
  1522.     
  1523.     '________________________________________________________________________
  1524.     ' setup variables
  1525.     Dim rStyle  As Long
  1526.     Dim r       As Long
  1527.     
  1528.     '________________________________________________________________________
  1529.     ' get the current styles
  1530.     rStyle = SendMessageLong(lstListViewName.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
  1531.     
  1532.     '________________________________________________________________________
  1533.     ' remove the selected style from the current styles
  1534.     rStyle = rStyle Xor LVS_EX_SUBITEMIMAGES
  1535.     
  1536.     '________________________________________________________________________
  1537.     ' update the listview styles
  1538.     SendMessageLong lstListViewName.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle
  1539.     
  1540.     '________________________________________________________________________
  1541.     ' exit before error handler
  1542.     Exit Function
  1543.     
  1544. '________________________________________________________________________
  1545. ' deal with errors
  1546. err_EnhListView_Rem_SubitemImages:
  1547.     
  1548.     '________________________________________________________________________
  1549.     ' set function return to false
  1550.     EnhListView_Rem_SubitemImages = False
  1551.     '________________________________________________________________________
  1552.     ' if you want notification on an error
  1553.     If bolShowErrors = True Then
  1554.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1555.                vbOKOnly + vbInformation, _
  1556.                "Error in Function : EnhListView_Rem_SubitemImages"
  1557.     End If
  1558.     
  1559.     '________________________________________________________________________
  1560.     ' initiate debug
  1561.     Debug.Print Now & vbTab & "Error in function: EnhListView_Rem_SubitemImages" _
  1562.                 & vbCrLf & _
  1563.                 Err.Number & vbTab & Err.Description
  1564.     Debug.Assert False
  1565.     
  1566.     '________________________________________________________________________
  1567.     ' exit
  1568.     Exit Function
  1569.     
  1570. End Function
  1571. '=======================================================================
  1572.  
  1573. '=======================================================================
  1574. ' Description: Checks all Items in the ListView
  1575. '=======================================================================
  1576. Public Function EnhLitView_CheckAllItems( _
  1577.                 lstListViewName As ListView, _
  1578.                 Optional bolShowErrors As Boolean) _
  1579.                 As Boolean
  1580.     
  1581.     '________________________________________________________________________
  1582.     ' initiate error handler
  1583.     On Error GoTo err_EnhLitView_CheckAllItems
  1584.     
  1585.     '________________________________________________________________________
  1586.     ' set function return to true
  1587.     EnhLitView_CheckAllItems = True
  1588.     
  1589.     '________________________________________________________________________
  1590.     ' setup variables
  1591.     Dim LV          As LVITEM
  1592.     Dim lvCount     As Long
  1593.     Dim lvIndex     As Long
  1594.     Dim lvState     As Long
  1595.     Dim r           As Long
  1596.     
  1597.     '________________________________________________________________________
  1598.     lvState = IIf(True, &H2000, &H1000)
  1599.     lvCount = lstListViewName.ListItems.Count - 1
  1600.     Do
  1601.         With LV
  1602.             .mask = LVIF_STATE
  1603.             .state = lvState
  1604.             .stateMask = LVIS_STATEIMAGEMASK
  1605.         End With
  1606.         r = SendMessageAny(lstListViewName.hwnd, LVM_SETITEMSTATE, lvIndex, LV)
  1607.         lvIndex = lvIndex + 1
  1608.     Loop Until lvIndex > lvCount
  1609.     
  1610.     '________________________________________________________________________
  1611.     ' exit before error handler
  1612.     Exit Function
  1613.     
  1614. '________________________________________________________________________
  1615. ' deal with errors
  1616. err_EnhLitView_CheckAllItems:
  1617.     
  1618.     '________________________________________________________________________
  1619.     ' set function return to false
  1620.     EnhLitView_CheckAllItems = False
  1621.     '________________________________________________________________________
  1622.     ' if you want notification on an error
  1623.     If bolShowErrors = True Then
  1624.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1625.                vbOKOnly + vbInformation, _
  1626.                "Error in Function : EnhLitView_CheckAllItems"
  1627.     End If
  1628.     
  1629.     '________________________________________________________________________
  1630.     ' initiate debug
  1631.     Debug.Print Now & vbTab & "Error in function: EnhLitView_CheckAllItems" _
  1632.                 & vbCrLf & _
  1633.                 Err.Number & vbTab & Err.Description
  1634.     Debug.Assert False
  1635.     
  1636.     '________________________________________________________________________
  1637.     ' exit
  1638.     Exit Function
  1639.     
  1640. End Function
  1641. '=======================================================================
  1642.  
  1643. '=======================================================================
  1644. ' Description: Unchecks all items in a ListView
  1645. '=======================================================================
  1646. Public Function EnhLitView_UnCheckAllItems( _
  1647.                 lstListViewName As ListView, _
  1648.                 Optional bolShowErrors As Boolean) _
  1649.                 As Boolean
  1650.     
  1651.     '________________________________________________________________________
  1652.     ' initiate error handler
  1653.     On Error GoTo err_EnhLitView_UnCheckAllItems
  1654.     
  1655.     '________________________________________________________________________
  1656.     ' set function return to true
  1657.     EnhLitView_UnCheckAllItems = True
  1658.     
  1659.     '________________________________________________________________________
  1660.     ' setup variables
  1661.     Dim LV          As LVITEM
  1662.     Dim lvCount     As Long
  1663.     Dim lvIndex     As Long
  1664.     Dim lvState     As Long
  1665.     Dim r           As Long
  1666.     
  1667.     '________________________________________________________________________
  1668.     lvState = IIf(True, &H2000, &H1000)
  1669.     lvCount = lstListViewName.ListItems.Count - 1
  1670.     Do
  1671.         With LV
  1672.             .mask = LVIF_STATE
  1673.             .state = lvState
  1674.             .stateMask = LVIS_STATEIMAGEMASK
  1675.         End With
  1676.         r = SendMessageAny(lstListViewName.hwnd, LVM_SETITEMSTATE, lvIndex, LV)
  1677.         lvIndex = lvIndex + 1
  1678.     Loop Until lvIndex > lvCount
  1679.     
  1680.     '________________________________________________________________________
  1681.     ' exit before error handler
  1682.     Exit Function
  1683.     
  1684. '________________________________________________________________________
  1685. ' deal with errors
  1686. err_EnhLitView_UnCheckAllItems:
  1687.     
  1688.     '________________________________________________________________________
  1689.     ' set function return to false
  1690.     EnhLitView_UnCheckAllItems = False
  1691.     '________________________________________________________________________
  1692.     ' if you want notification on an error
  1693.     If bolShowErrors = True Then
  1694.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1695.                vbOKOnly + vbInformation, _
  1696.                "Error in Function : EnhLitView_UnCheckAllItems"
  1697.     End If
  1698.     
  1699.     '________________________________________________________________________
  1700.     ' initiate debug
  1701.     Debug.Print Now & vbTab & "Error in function: EnhLitView_UnCheckAllItems" _
  1702.                 & vbCrLf & _
  1703.                 Err.Number & vbTab & Err.Description
  1704.     Debug.Assert False
  1705.     
  1706.     '________________________________________________________________________
  1707.     ' exit
  1708.     Exit Function
  1709.     
  1710. End Function
  1711. '=======================================================================
  1712.  
  1713.  
  1714. '=======================================================================
  1715. ' Description: Inverts all checked items in a ListView
  1716. '=======================================================================
  1717. Public Function EnhListView_InvertAllChecks( _
  1718.                 lstListViewName As ListView, _
  1719.                 Optional bolShowErrors As Boolean) _
  1720.                 As Boolean
  1721.     
  1722.     '________________________________________________________________________
  1723.     ' initiate error handler
  1724.     On Error GoTo err_EnhListView_InvertAllChecks
  1725.     
  1726.     '________________________________________________________________________
  1727.     ' set function return to true
  1728.     EnhListView_InvertAllChecks = True
  1729.     
  1730.     '________________________________________________________________________
  1731.     ' setup variables
  1732.     Dim LV          As LVITEM
  1733.     Dim r           As Long
  1734.     Dim lvCount     As Long
  1735.     Dim lvIndex     As Long
  1736.     
  1737.     '________________________________________________________________________
  1738.     lvCount = lstListViewName.ListItems.Count - 1
  1739.     Do
  1740.         r = SendMessageLong(lstListViewName.hwnd, LVM_GETITEMSTATE, lvIndex, LVIS_STATEIMAGEMASK)
  1741.         With LV
  1742.             .mask = LVIF_STATE
  1743.             .stateMask = LVIS_STATEIMAGEMASK
  1744.             If r And &H2000& Then
  1745.                 .state = &H1000
  1746.             Else
  1747.                 .state = &H2000
  1748.             End If
  1749.         End With
  1750.         r = SendMessageAny(lstListViewName.hwnd, LVM_SETITEMSTATE, lvIndex, LV)
  1751.         lvIndex = lvIndex + 1
  1752.     Loop Until lvIndex > lvCount
  1753.     
  1754.     '________________________________________________________________________
  1755.     ' exit before error handler
  1756.     Exit Function
  1757.     
  1758. '________________________________________________________________________
  1759. ' deal with errors
  1760. err_EnhListView_InvertAllChecks:
  1761.     
  1762.     '________________________________________________________________________
  1763.     ' set function return to false
  1764.     EnhListView_InvertAllChecks = False
  1765.     '________________________________________________________________________
  1766.     ' if you want notification on an error
  1767.     If bolShowErrors = True Then
  1768.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1769.                vbOKOnly + vbInformation, _
  1770.                "Error in Function : EnhListView_InvertAllChecks"
  1771.     End If
  1772.     
  1773.     '________________________________________________________________________
  1774.     ' initiate debug
  1775.     Debug.Print Now & vbTab & "Error in function: EnhListView_InvertAllChecks" _
  1776.                 & vbCrLf & _
  1777.                 Err.Number & vbTab & Err.Description
  1778.     Debug.Assert False
  1779.     
  1780.     '________________________________________________________________________
  1781.     ' exit
  1782.     Exit Function
  1783.     
  1784. End Function
  1785. '=======================================================================
  1786.  
  1787. '=======================================================================
  1788. ' Description: Toggles FlatColumnHeaders in a ListView
  1789. '=======================================================================
  1790. Public Function EnhListView_Toggle_FlatColumnHeaders( _
  1791.                 frmFormName As Form, _
  1792.                 lstListViewName As ListView, _
  1793.                 Optional bolShowErrors As Boolean) _
  1794.                 As Boolean
  1795.     
  1796.     '________________________________________________________________________
  1797.     ' initiate error handler
  1798.     On Error GoTo err_EnhListView_Toggle_FlatColumnHeaders
  1799.     
  1800.     '________________________________________________________________________
  1801.     ' set function return to true
  1802.     EnhListView_Toggle_FlatColumnHeaders = True
  1803.     
  1804.     '________________________________________________________________________
  1805.     SetWindowLong SendMessageLong(lstListViewName.hwnd, _
  1806.                                  LVM_GETHEADER, _
  1807.                                  0, _
  1808.                                  ByVal 0&), _
  1809.                                  GWL_STYLE, _
  1810.                                  GetWindowLong(SendMessageLong(lstListViewName.hwnd, _
  1811.                                                                LVM_GETHEADER, _
  1812.                                                                0, _
  1813.                                                                ByVal _
  1814.                                                                0&), _
  1815.                                                                GWL_STYLE) _
  1816.                                                                Xor HDS_BUTTONS
  1817.     SetWindowPos lstListViewName.hwnd, _
  1818.                  frmFormName.hwnd, _
  1819.                  0, _
  1820.                  0, _
  1821.                  0, _
  1822.                  0, _
  1823.                  SWP_FLAGS
  1824.     
  1825.     '________________________________________________________________________
  1826.     ' exit before error handler
  1827.     Exit Function
  1828.     
  1829. '________________________________________________________________________
  1830. ' deal with errors
  1831. err_EnhListView_Toggle_FlatColumnHeaders:
  1832.     
  1833.     '________________________________________________________________________
  1834.     ' set function return to false
  1835.     EnhListView_Toggle_FlatColumnHeaders = False
  1836.     '________________________________________________________________________
  1837.     ' if you want notification on an error
  1838.     If bolShowErrors = True Then
  1839.         MsgBox "Error" & Err.Number & vbTab & Err.Description, _
  1840.                vbOKOnly + vbInformation, _
  1841.                "Error in Function : EnhListView_Toggle_FlatColumnHeaders"
  1842.     End If
  1843.     
  1844.     '________________________________________________________________________
  1845.     ' initiate debug
  1846.     Debug.Print Now & vbTab & "Error in function: EnhListView_Toggle_FlatColumnHeaders" _
  1847.                 & vbCrLf & _
  1848.                 Err.Number & vbTab & Err.Description
  1849.     Debug.Assert False
  1850.     
  1851.     '________________________________________________________________________
  1852.     ' exit
  1853.     Exit Function
  1854.     
  1855. End Function
  1856. '=======================================================================
  1857.